package com.gagakuai.engine.impl.interceptor;

/*
 * @program: common-starters
 * @description: 命令执行器:在这里而言：所有的命令对象会经过这样的周期
 * CommandInterceptor_1 ---> CommandInterceptor_2 ---> CommandInterceptor_3
 * Command    <---
 * CommandInterceptor_1 <--- CommandInterceptor_2 <--- CommandInterceptor_3   <--
 * @author: houhong
 * @create: 2023-01-01 23:02
 */
public interface CommandExecutor {

    /*
     * 获取默认的命令执行配置
     *
     * @return CommandConfig
     * @see CommandConfig
     */
    CommandConfig getDefaultConfig();

    /*
     *  通过命令配置执行命令:在执行之前会先走一遍拦截器链，然后执行Command
     *
     * @return CommandConfig
     * @see T
     */
    <T> T execute(CommandConfig config,Command<T> command);


    <T> T execute(Command<T> command);

}